local hx__pijian = fk.CreateSkill {
  name = "hx__pijian",
  tags = { Skill.Compulsory },
}

hx__pijian:addEffect(fk.EventPhaseStart, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(hx__pijian.name) and player.phase == Player.Finish and
      #player:getPile("hx__yanzuo") >= #player.room.alive_players
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if player.dead then return end
    local to = room:askToChoosePlayers(player, {
      targets = room.alive_players,
      min_num = 1,
      max_num = 1,
      prompt = "#hx__pijian-choose",
      skill_name = hx__pijian.name,
      cancelable = false,
    })
    room:loseHp(to[1], 2, hx__pijian.name)
  end
})

return hx__pijian
